<% include common/header.htm %>
<h1><%=title%></h1>
<!--<form method="post">
	<h2>昵称</h2>
	<input type="text" placeholder="昵称" value=""><br>
    <h2>密码</h2>
    <input type="password" placeholder="密码" value="" ><br>
    <input type="submit" value="注册">
</form>-->
<form method="post">
  <div class="form-group">
    <label for="exampleInputEmail1">用户名</label>
    <input type="text" class="form-control" id="name" name="name" placeholder="用户名">
  </div>
  <div class="form-group">
    <label for="exampleInputPassword1">密码</label>
    <input type="password" class="form-control" id="password" name="password" placeholder="密码">
  </div>
  
 
  <button type="submit" onClick="postData(this); return false;" class="btn btn-default">注册</button>
</form>
<div class="modal fade" id="msg-box">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title">Modal title</h4>
      </div>
      <div class="modal-body">
        <p id="content">One fine body&hellip;</p>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">确定</button>
      </div>
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div><!-- /.modal -->

<script type="text/javascript">

function postData (_this){
	
	$.post('/reg', {
		name: $('#name').val(),
		password: $('#password').val()
	}, function (data){
		console.log(data);
		$('#content').html(data.msg);
		$('#msg-box').modal('show');
		
		if(data.status){
			window.location.href = '/';
		}
		
	});
	
}

</script>


<% include common/footer.htm %>